package com.guiji.utils;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class PropertiesUtils {

    private static PropertiesConfiguration config;

    static {
        try {
            config = new PropertiesConfiguration("src/main/resources/config.properties");
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }
    }

    //工具类构造方法私有
    private PropertiesUtils(){}

    public static String getString(String key){
        return config.getString(key,"");
    }

    public static int getInt(String key){
        return config.getInt(key,1);
    }

    public static boolean getBoolean(String key){
        return config.getBoolean(key,false);
    }

    public static String[] getStringArray(String key){
        return config.getStringArray(key);
    }


}
